-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #1128: Removed multiple DPA get calls for Reconcilers #1316
Conversation
7d9cd21
to
268eb03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
3 similar comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@sseago @shubham-pampattiwar please review :) |
I am unsure about the changes here, I think the rationale behind fetching the DPA explicitly in every reconcile function was to get the latest DPA available in the cluster. |
But we are not updating the DPA after validation right? so we can use the same DPA fetching it once? |
Each reconcile you see is called right after the other in the same loop. Current implementation prior to this PR mean we're doing like 10 or so get calls within a span of 1-2 seconds, more likely to have issues with "outdated-copy" during update calls that rely on multiple gets so close to each other. Also the client backoff throttling. I think it's best to get once, update once in entire batch. Perhaps add to the end This would help in cu environments with busy api server. |
if err := r.Get(ctx, req.NamespacedName, &dpa); err != nil {
log.Error(err, "unable to fetch DataProtectionApplication CR")
return result, nil
}
+ //--deep copy here
// set client to pkg/client for use in non-reconcile functions
oadpClient.SetClient(r.Client)
_, err := ReconcileBatch(r.Log,
r.ValidateDataProtectionCR,
r.ReconcileFsRestoreHelperConfig,
...
)
if err != nil {
apimeta.SetStatusCondition(&dpa.Status.Conditions,
metav1.Condition{
Type: oadpv1alpha1.ConditionReconciled,
Status: metav1.ConditionFalse,
Reason: oadpv1alpha1.ReconciledReasonError,
Message: err.Error(),
},
)
} else {
apimeta.SetStatusCondition(&dpa.Status.Conditions,
metav1.Condition{
Type: oadpv1alpha1.ConditionReconciled,
Status: metav1.ConditionTrue,
Reason: oadpv1alpha1.ReconciledReasonComplete,
Message: oadpv1alpha1.ReconcileCompleteMessage,
},
)
}
+ // patch spec updates
statusErr := r.Client.Status().Update(ctx, &dpa)
if err == nil { // Don't mask previous error
err = statusErr
} |
@kaovilai why do we need a deep copy here? Do you mean to create a copy of DPA (lets say copiedDpa) and pass that copiedDpa in all the reconcile functions, and then based on that copiedDpa, update the dpa using Patch() ? |
I meant deepcopy to have orignal in the function, then pass to copy to funcs, that way you have orignalFromClusterDPA, and updatedFromReconcilerDpa Example: |
Reconcile shouldn't update dpa.. so ignore my comment about patching. |
@shubham-pampattiwar review please. |
95fc7b5
to
59f86fd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ff98b21
to
1082e59
Compare
1082e59
to
35ffda4
Compare
35ffda4
to
ee2f611
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @shubham-pampattiwar
Please check if this change is ok with you.
@stillalearner Please update the PR to fix #1127 as well, changes are similar and less disruptive. Or Do you want to create a separate PR for it ? |
@shubham-pampattiwar Separate would be better for 1127 as i have to still go through that one.. Lets close this one first. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kaovilai, mateusoliveira43, shubham-pampattiwar, stillalearner The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
1 similar comment
/retest-required |
infra flake
/override ci/prow/4.17-e2e-test-kubevirt-aws |
@kaovilai: Overrode contexts on behalf of kaovilai: ci/prow/4.17-e2e-test-kubevirt-aws In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@stillalearner: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
00155e1
into
openshift:master
Fixed #1128